package com.test30_IO流;

import org.junit.Test;

import java.io.File;
import java.io.FileReader;
import java.io.Reader;

/**
 * Reader，字符输入流
 */
public class Demo04_Reader {

    /**
     * 实现数据读取
     */
    @Test
    public void test1() {
        File file = new File("F:" + File.separator + "muyan" + File.separator + "vip" + File.separator + "yootk.txt");
        if (file.exists()) {
            try (Reader in = new FileReader(file)) {
                char[] data = new char[1024];
                int len = in.read(data);
                System.out.println(new String(data, 0, len));
            } catch (Exception e) {
            }
        }
    }
}
